#pragma once
#include <iostream>
#include <sys/epoll.h>
#include <unistd.h>
class Epoll
{
public:
    static const int gsize=256;
    static int CreateEpoll()
    {
        int epfd=epoll_create(gsize);
        if(epfd>0) return epfd;
        else
        {
            exit(5);
        }
    }
    //对哪个epoll模型 什么操作 哪个文件 事件是什么EPPLLIN?EPOLLOUT?
    static bool CtlEpoll(int epfd,int oper,int sock,uint32_t events)
    {
        struct epoll_event ev;
        ev.events=events;
        ev.data.fd=sock;
        int n=epoll_ctl(epfd,oper,sock,&ev);
        return n==0;
    }
    static int WaitEpoll(int epfd,struct epoll_event revs[],int num,int timeout)
    {
        return epoll_wait(epfd,revs,num,timeout);
    }
};